Load all required libraries.

library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5     v purrr   0.3.4
## v tibble  3.1.6     v dplyr   1.0.8
## v tidyr   1.2.0     v stringr 1.4.0
## v readr   2.1.2     v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
library(broom)

Read in raw data from RDS.

raw_data <- readRDS("./n1_n2_cleaned_cases.rds")

Make a few small modifications to names and data for visualizations.

final_data <- raw_data %>% mutate(log_copy_per_L = log10(mean_copy_num_L)) %>%
  rename(Facility = wrf) %>%
  mutate(Facility = recode(Facility, 
                           "NO" = "WRF A",
                           "MI" = "WRF B",
                           "CC" = "WRF C"))

Seperate the data by gene target to ease layering in the final plot

#make three data layers
only_positives <<- subset(final_data, (!is.na(final_data$Facility)))
only_n1 <- subset(only_positives, target == "N1")
only_n2 <- subset(only_positives, target == "N2")
only_background <<-final_data %>% 
  select(c(date, cases_cum_clarke, new_cases_clarke, X7_day_ave_clarke)) %>%
  group_by(date) %>% summarise_if(is.numeric, mean)

#specify fun colors
background_color <- "#7570B3"
seven_day_ave_color <- "#E6AB02"
marker_colors <- c("N1" = '#1B9E77',"N2" ='#D95F02')
#remove facilty C for now
#only_n1 <- only_n1[!(only_n1$Facility == "WRF C"),]
#only_n2 <- only_n2[!(only_n2$Facility == "WRF C"),]

only_n1 <- only_n1[!(only_n1$Facility == "WRF A" & only_n1$date == "2020-11-02"), ]
only_n2 <- only_n2[!(only_n2$Facility == "WRF A" & only_n2$date == "2020-11-02"), ]

Build the main plot

      #first layer is the background epidemic curve
        p1 <- only_background %>%
              plotly::plot_ly() %>%
              plotly::add_trace(x = ~date, y = ~new_cases_clarke, 
                                type = "bar", 
                                hoverinfo = "text",
                                text = ~paste('</br> Date: ', date,
                                                     '</br> Daily Cases: ', new_cases_clarke),
                                alpha = 0.5,
                                name = "Daily Reported Cases",
                                color = background_color,
                                colors = background_color,
                                showlegend = FALSE) %>%
            layout(yaxis = list(title = "Clarke County Daily Cases", showline=TRUE)) %>%
            layout(legend = list(orientation = "h", x = 0.2, y = -0.3))
        
        #renders the main plot layer two as seven day moving average
        p1 <- p1 %>% plotly::add_trace(x = ~date, y = ~X7_day_ave_clarke, 
                             type = "scatter",
                             mode = "lines",
                             hoverinfo = "text",
                            text = ~paste('</br> Date: ', date,
                                                     '</br> Seven-Day Moving Average: ', X7_day_ave_clarke),
                             name = "Seven Day Moving Average Athens",
                             line = list(color = seven_day_ave_color),
                             showlegend = FALSE)
      

        
        #renders the main plot layer three as positive target hits
        
        p2 <- plotly::plot_ly() %>%
          plotly::add_trace(x = ~date, y = ~mean_copy_num_L,
                                       type = "scatter",
                                       mode = "markers",
                                       hoverinfo = "text",
                                       text = ~paste('</br> Date: ', date,
                                                     '</br> Facility: ', Facility,
                                                     '</br> Target: ', target,
                                                     '</br> Copies/L: ', round(mean_copy_num_L, digits = 2)),
                                       data = only_n1,
                                       symbol = ~Facility,
                                       marker = list(color = '#1B9E77', size = 8, opacity = 0.65),
                                       showlegend = FALSE) %>%
          plotly::add_trace(x = ~date, y = ~mean_copy_num_L,
                                       type = "scatter",
                                       mode = "markers",
                                       hoverinfo = "text",
                                       text = ~paste('</br> Date: ', date,
                                                     '</br> Facility: ', Facility,
                                                     '</br> Target: ', target,
                                                     '</br> Copies/L: ', round(mean_copy_num_L, digits = 2)),
                                       data = only_n2,
                                       symbol = ~Facility,
                                       marker = list(color = '#D95F02', size = 8, opacity = 0.65),
                                       showlegend = FALSE) %>%
            layout(yaxis = list(title = "SARS CoV-2 Copies/L", 
                                 showline = TRUE,
                                 type = "log",
                                 dtick = 1,
                                 automargin = TRUE)) %>%
            layout(legend = list(orientation = "h", x = 0.2, y = -0.3))
        
        #adds the limit of detection dashed line
        p2 <- p2 %>% plotly::add_segments(x = as.Date("2020-03-14"), 
                                          xend = ~max(date + 10), 
                                          y = 3571.429, yend = 3571.429,
                                          opacity = 0.35,
                                          line = list(color = "black", dash = "dash")) %>%
          layout(annotations = list(x = as.Date("2020-03-28"), y = 3.8, xref = "x", yref = "y", 
                                    text = "Limit of Detection", showarrow = FALSE))

        

        p1
        p2

Combine the two main plot pieces as a subplot

#seperate n1 and n2 frames by site
#n1
wrf_a_only_n1 <- subset(only_n1, Facility == "WRF A")
wrf_b_only_n1 <- subset(only_n1, Facility == "WRF B")
wrf_c_only_n1 <- subset(only_n1, Facility == "WRF C")

#n2
wrf_a_only_n2 <- subset(only_n2, Facility == "WRF A")
wrf_b_only_n2 <- subset(only_n2, Facility == "WRF B")
wrf_c_only_n2 <- subset(only_n2, Facility == "WRF C")


#rejoin the old data frames then seperate in to averages for each plant. 
wrfa_both <- full_join(wrf_a_only_n1, wrf_a_only_n2)%>%
  select(c(date, mean_total_copies)) %>%
  group_by(date) %>%
  summarize_if(is.numeric, mean) %>%
  ungroup() %>%
  mutate(log_total_copies_both = log10(mean_total_copies))
## Joining, by = c("date", "new_cases_clarke", "cases_cum_clarke",
## "X7_day_ave_clarke", "Facility", "collection_num", "target",
## "mean_copy_num_uL_rxn", "mean_copy_num_L", "sd_L", "se_L", "mean_total_copies",
## "sd_total_copies", "lo_95", "up_95", "log_copy_per_L")
wrfb_both <- full_join(wrf_b_only_n1, wrf_b_only_n2)%>%
  select(c(date, mean_total_copies)) %>%
  group_by(date) %>%
  summarize_if(is.numeric, mean) %>%
  ungroup() %>%
  mutate(log_total_copies_both = log10(mean_total_copies))
## Joining, by = c("date", "new_cases_clarke", "cases_cum_clarke",
## "X7_day_ave_clarke", "Facility", "collection_num", "target",
## "mean_copy_num_uL_rxn", "mean_copy_num_L", "sd_L", "se_L", "mean_total_copies",
## "sd_total_copies", "lo_95", "up_95", "log_copy_per_L")
wrfc_both <- full_join(wrf_c_only_n1, wrf_c_only_n2)%>%
  select(c(date, mean_total_copies)) %>%
  group_by(date) %>%
  summarize_if(is.numeric, mean) %>%
  ungroup() %>%
  mutate(log_total_copies_both = log10(mean_total_copies))
## Joining, by = c("date", "new_cases_clarke", "cases_cum_clarke",
## "X7_day_ave_clarke", "Facility", "collection_num", "target",
## "mean_copy_num_uL_rxn", "mean_copy_num_L", "sd_L", "se_L", "mean_total_copies",
## "sd_total_copies", "lo_95", "up_95", "log_copy_per_L")
#get max date
maxdate <- max(wrfa_both$date)
mindate <- min(wrfa_both$date)

Build loess smoothing figures figures

This makes the individual plots

#**************************************WRF A PLOT**********************************************
#add trendlines 
#extract data from geom_smooth
#both extract
# *********************************span 0.6***********************************
#*****************Must always update the n = TOTAL NUMBER OF DAYS*************************
extract_botha <- ggplot(wrfa_both, aes(x = date, y = log_total_copies_both)) + 
  stat_smooth(aes(outfit=fit_botha<<-..y..), method = "loess", color = '#1B9E77', 
              span = 0.25, n = 751)
## Warning: Ignoring unknown aesthetics: outfit
#look at the fits to align dates and total observations
#both
extract_botha
## `geom_smooth()` using formula 'y ~ x'

fit_botha
##   [1] 13.04102 13.03689 13.03283 13.02882 13.02487 13.02098 13.01713 13.01334
##   [9] 13.00959 13.00589 13.00224 12.99862 12.99504 12.99149 12.98798 12.98450
##  [17] 12.98105 12.97762 12.97422 12.97084 12.96747 12.96412 12.96079 12.95746
##  [25] 12.95415 12.95084 12.94753 12.94423 12.94092 12.93761 12.93430 12.93098
##  [33] 12.92764 12.92430 12.92093 12.91755 12.91415 12.91075 12.90733 12.90391
##  [41] 12.90049 12.89707 12.89366 12.89026 12.88686 12.88349 12.88013 12.87680
##  [49] 12.87349 12.87020 12.86696 12.86374 12.86057 12.85743 12.85435 12.85131
##  [57] 12.84832 12.84539 12.84252 12.83970 12.83696 12.83428 12.83167 12.82914
##  [65] 12.82669 12.82431 12.82203 12.81983 12.81772 12.81571 12.81379 12.81198
##  [73] 12.81027 12.80867 12.80718 12.80581 12.80455 12.80341 12.80224 12.80088
##  [81] 12.79934 12.79764 12.79579 12.79380 12.79169 12.78946 12.78713 12.78472
##  [89] 12.78223 12.77968 12.77708 12.77444 12.77178 12.76911 12.76644 12.76379
##  [97] 12.76116 12.75858 12.75604 12.75357 12.75118 12.74888 12.74668 12.74459
## [105] 12.74264 12.74083 12.73917 12.73767 12.73636 12.73524 12.73432 12.73362
## [113] 12.73315 12.73293 12.73296 12.73325 12.73383 12.73470 12.73588 12.73738
## [121] 12.73954 12.74266 12.74667 12.75151 12.75710 12.76338 12.77028 12.77773
## [129] 12.78568 12.79403 12.80275 12.81174 12.82095 12.83031 12.83975 12.84920
## [137] 12.85860 12.86788 12.87697 12.88580 12.89431 12.90243 12.91008 12.91722
## [145] 12.92375 12.92963 12.93478 12.94082 12.94925 12.95982 12.97227 12.98637
## [153] 13.00185 13.01847 13.03598 13.05412 13.07264 13.09130 13.10984 13.12801
## [161] 13.14556 13.16224 13.17780 13.19199 13.20455 13.21524 13.22381 13.23000
## [169] 13.23540 13.24170 13.24881 13.25664 13.26509 13.27408 13.28352 13.29331
## [177] 13.30336 13.31359 13.32389 13.33419 13.34439 13.35440 13.36412 13.37347
## [185] 13.38236 13.39069 13.39838 13.40533 13.41146 13.41666 13.42086 13.42396
## [193] 13.42587 13.42649 13.42574 13.42353 13.41976 13.41435 13.40708 13.39790
## [201] 13.38695 13.37437 13.36033 13.34495 13.32840 13.31081 13.29233 13.27311
## [209] 13.25330 13.23304 13.21247 13.19175 13.17102 13.15043 13.13012 13.11025
## [217] 13.09095 13.07238 13.05467 13.03553 13.01280 12.98684 12.95801 12.92669
## [225] 12.89323 12.85800 12.82137 12.78370 12.74536 12.70670 12.66811 12.62994
## [233] 12.59255 12.55632 12.52160 12.48877 12.45819 12.43021 12.40522 12.38357
## [241] 12.36358 12.34338 12.32303 12.30256 12.28205 12.26154 12.24109 12.22075
## [249] 12.20058 12.18062 12.16095 12.14160 12.12264 12.10412 12.08609 12.06861
## [257] 12.05174 12.03552 12.02001 12.00526 11.99134 11.97904 11.96900 11.96100
## [265] 11.95483 11.95028 11.94714 11.94520 11.94425 11.94408 11.94448 11.94523
## [273] 11.94613 11.94697 11.94753 11.94760 11.94698 11.94545 11.94280 11.93883
## [281] 11.93331 11.92604 11.91822 11.91113 11.90469 11.89882 11.89344 11.88849
## [289] 11.88387 11.87952 11.87535 11.87129 11.86726 11.86318 11.85897 11.85456
## [297] 11.84987 11.84483 11.83934 11.83334 11.82675 11.81950 11.81149 11.80234
## [305] 11.79180 11.78004 11.76720 11.75345 11.73895 11.72384 11.70829 11.69246
## [313] 11.67649 11.66056 11.64481 11.62940 11.61450 11.60025 11.58682 11.57435
## [321] 11.56302 11.55297 11.54437 11.53737 11.52993 11.52013 11.50825 11.49459
## [329] 11.47945 11.46311 11.44587 11.42802 11.40987 11.39169 11.37379 11.35646
## [337] 11.34000 11.32469 11.31083 11.29871 11.28864 11.28090 11.27578 11.27358
## [345] 11.27460 11.27798 11.28263 11.28848 11.29547 11.30353 11.31260 11.32260
## [353] 11.33347 11.34514 11.35756 11.37064 11.38433 11.39856 11.41326 11.42836
## [361] 11.44381 11.45953 11.47545 11.49152 11.50765 11.52380 11.54172 11.56305
## [369] 11.58752 11.61485 11.64479 11.67704 11.71135 11.74744 11.78504 11.82388
## [377] 11.86369 11.90419 11.94512 11.98621 12.02718 12.06776 12.10768 12.14666
## [385] 12.18445 12.22077 12.25533 12.28789 12.31815 12.34586 12.37074 12.39252
## [393] 12.41433 12.43916 12.46652 12.49590 12.52682 12.55878 12.59128 12.62383
## [401] 12.65594 12.68711 12.71684 12.74463 12.77001 12.79246 12.81149 12.82662
## [409] 12.83921 12.85100 12.86199 12.87222 12.88169 12.89042 12.89844 12.90577
## [417] 12.91241 12.91840 12.92374 12.92847 12.93258 12.93611 12.93908 12.94149
## [425] 12.94338 12.94475 12.94563 12.94604 12.94598 12.94412 12.93924 12.93163
## [433] 12.92156 12.90930 12.89514 12.87934 12.86219 12.84395 12.82491 12.80534
## [441] 12.78551 12.76569 12.74617 12.72722 12.70912 12.69213 12.67654 12.66261
## [449] 12.65064 12.64088 12.63123 12.61955 12.60604 12.59093 12.57444 12.55679
## [457] 12.53818 12.51885 12.49901 12.47887 12.45866 12.43860 12.41890 12.39978
## [465] 12.38145 12.36415 12.34808 12.33347 12.32053 12.30948 12.30054 12.29233
## [473] 12.28339 12.27384 12.26379 12.25337 12.24268 12.23185 12.22098 12.21019
## [481] 12.19960 12.18932 12.17946 12.17015 12.16150 12.15361 12.14662 12.14063
## [489] 12.13576 12.13212 12.12983 12.12900 12.12984 12.13242 12.13660 12.14227
## [497] 12.14931 12.15760 12.16701 12.17743 12.18873 12.20081 12.21352 12.22676
## [505] 12.24041 12.25434 12.26843 12.28257 12.29664 12.31050 12.32405 12.33716
## [513] 12.34971 12.36159 12.37266 12.38282 12.39194 12.39990 12.40875 12.42041
## [521] 12.43456 12.45088 12.46905 12.48874 12.50965 12.53144 12.55380 12.57641
## [529] 12.59895 12.62110 12.64254 12.66294 12.68199 12.69937 12.71476 12.72783
## [537] 12.73827 12.74576 12.74998 12.75240 12.75468 12.75681 12.75875 12.76047
## [545] 12.76196 12.76318 12.76410 12.76471 12.76496 12.76484 12.76432 12.76337
## [553] 12.76197 12.76008 12.75768 12.75475 12.75125 12.74716 12.74245 12.73710
## [561] 12.73107 12.72435 12.71690 12.70870 12.69973 12.68994 12.67932 12.66607
## [569] 12.64878 12.62799 12.60423 12.57805 12.54999 12.52058 12.49037 12.45990
## [577] 12.42970 12.40032 12.37230 12.34618 12.32249 12.30179 12.28460 12.26743
## [585] 12.24668 12.22274 12.19599 12.16683 12.13564 12.10281 12.06873 12.03379
## [593] 11.99839 11.96289 11.92771 11.89322 11.85981 11.82787 11.79780 11.76997
## [601] 11.74478 11.72262 11.70388 11.68894 11.67615 11.66362 11.65139 11.63949
## [609] 11.62796 11.61683 11.60614 11.59592 11.58621 11.57705 11.56847 11.56051
## [617] 11.55319 11.54656 11.54066 11.53551 11.53115 11.52763 11.52496 11.52320
## [625] 11.52237 11.52332 11.52673 11.53240 11.54012 11.54970 11.56092 11.57358
## [633] 11.58749 11.60243 11.61820 11.63459 11.65141 11.66845 11.68550 11.70237
## [641] 11.71884 11.73472 11.74979 11.76386 11.77672 11.78817 11.79999 11.81394
## [649] 11.82983 11.84743 11.86654 11.88696 11.90846 11.93085 11.95390 11.97742
## [657] 12.00118 12.02499 12.04863 12.07188 12.09455 12.11642 12.13728 12.15692
## [665] 12.17513 12.19170 12.20643 12.22024 12.23421 12.24831 12.26252 12.27681
## [673] 12.29115 12.30551 12.31989 12.33424 12.34854 12.36277 12.37691 12.39092
## [681] 12.40478 12.41848 12.43197 12.44524 12.45826 12.47100 12.48345 12.49557
## [689] 12.50734 12.51873 12.52972 12.54029 12.55041 12.56023 12.56992 12.57948
## [697] 12.58890 12.59818 12.60732 12.61630 12.62513 12.63380 12.64230 12.65064
## [705] 12.65880 12.66678 12.67458 12.68220 12.68962 12.69684 12.70387 12.71069
## [713] 12.71730 12.72369 12.72990 12.73594 12.74181 12.74752 12.75305 12.75842
## [721] 12.76361 12.76864 12.77348 12.77815 12.78264 12.78695 12.79109 12.79503
## [729] 12.79880 12.80238 12.80577 12.80898 12.81200 12.81482 12.81746 12.81989
## [737] 12.82210 12.82411 12.82591 12.82750 12.82889 12.83009 12.83109 12.83191
## [745] 12.83253 12.83297 12.83323 12.83331 12.83322 12.83295 12.83252
#assign fits to a vector
both_trenda <- fit_botha

#extract y min and max for each
limits_botha <- ggplot_build(extract_botha)$data
## `geom_smooth()` using formula 'y ~ x'
limits_botha <- as.data.frame(limits_botha)
both_ymina <- limits_botha$ymin
both_ymaxa <- limits_botha$ymax

#reassign dataframes (just to be safe)
work_botha <- wrfa_both

#fill in missing dates to smooth fits
work_botha <- work_botha %>% complete(date = seq(min(date), max(date), by = "1 day"))
date_vec_botha <- work_botha$date

#create a new smooth dataframe to layer
smooth_frame_botha <- data.frame(date_vec_botha, both_trenda, both_ymina, both_ymaxa)
#WRF A
#plot smooth frames
p_wrf_a <- plotly::plot_ly() %>%
  plotly::add_lines(x = ~date_vec_botha, y = ~both_trenda,
                    data = smooth_frame_botha,
                    hoverinfo = "text",
                    text = ~paste('</br> Date: ', date_vec_botha,
                                  '</br> Median Log Copies: ', round(both_trenda, digits = 2)),
                    line = list(color = '#1B9E77', size = 8, opacity = 0.65),
                    showlegend = FALSE) %>%
     layout(xaxis = list(range = c(mindate - 7, maxdate + 7))) %>% #buffer here
plotly::add_ribbons(x ~date_vec_botha, ymin = ~both_ymina, ymax = ~both_ymaxa,
                    showlegend = FALSE,
                    opacity = 0.25,
                    hoverinfo = "text",
                    text = ~paste('</br> Date: ', date_vec_botha, #leaving in case we want to change
                                  '</br> Max Log Copies: ', round(both_ymaxa, digits = 2),
                                  '</br> Min Log Copies: ', round(both_ymina, digits = 2)),
                    name = "",
                    fillcolor = '#1B9E77',
                    line = list(color = '#1B9E77')) %>%
                layout(yaxis = list(title = "Total Log10 SARS CoV-2 Copies", 
                                 showline = TRUE,
                                 automargin = TRUE)) %>%
                layout(xaxis = list(title = "Date")) %>%
                layout(title = "WRF A") %>%
  plotly::add_markers(x = ~date, y = ~log_total_copies_both,
                      data = wrfa_both,
                       hoverinfo = "text",
                       showlegend = FALSE,
                       text = ~paste('</br> Date: ', date, 
                                     '</br> Actual Log Copies: ', round(log_total_copies_both, digits = 2)),
                       marker = list(color = '#1B9E77', size = 6, opacity = 0.65))

p_wrf_a
save(p_wrf_a, file = "./plotly_objs/p_wrf_a.rda")
#**************************************WRF B PLOT**********************************************
#add trendlines 
#extract data from geom_smooth
#both extract
# *********************************span 0.6***********************************
#*****************Must always update the n = TOTAL NUMBER OF DAYS*************************
extract_bothb <- ggplot(wrfb_both, aes(x = date, y = log_total_copies_both)) + 
  stat_smooth(aes(outfit=fit_bothb<<-..y..), method = "loess", color = '#D95F02', 
              span = 0.25, n = 751)
## Warning: Ignoring unknown aesthetics: outfit
#look at the fits to align dates and total observations
#both
extract_bothb
## `geom_smooth()` using formula 'y ~ x'

fit_bothb
##   [1] 12.63126 12.62642 12.62167 12.61703 12.61248 12.60804 12.60368 12.59942
##   [9] 12.59526 12.59118 12.58719 12.58329 12.57948 12.57575 12.57210 12.56854
##  [17] 12.56505 12.56165 12.55831 12.55506 12.55188 12.54877 12.54573 12.54275
##  [25] 12.53985 12.53701 12.53423 12.53152 12.52887 12.52628 12.52374 12.52126
##  [33] 12.51884 12.51647 12.51414 12.51187 12.50965 12.50746 12.50532 12.50323
##  [41] 12.50119 12.49920 12.49726 12.49539 12.49357 12.49182 12.49014 12.48852
##  [49] 12.48698 12.48551 12.48411 12.48280 12.48157 12.48043 12.47937 12.47841
##  [57] 12.47753 12.47676 12.47608 12.47551 12.47503 12.47467 12.47442 12.47428
##  [65] 12.47425 12.47434 12.47455 12.47489 12.47535 12.47594 12.47666 12.47752
##  [73] 12.47851 12.47965 12.48092 12.48234 12.48391 12.48563 12.48752 12.48958
##  [81] 12.49182 12.49423 12.49680 12.49954 12.50243 12.50548 12.50867 12.51200
##  [89] 12.51548 12.51908 12.52282 12.52668 12.53066 12.53476 12.53897 12.54328
##  [97] 12.54770 12.55222 12.55683 12.56152 12.56631 12.57117 12.57611 12.58111
## [105] 12.58619 12.59132 12.59652 12.60176 12.60706 12.61240 12.61777 12.62319
## [113] 12.62863 12.63410 12.63959 12.64509 12.65061 12.65614 12.66166 12.66719
## [121] 12.67292 12.67903 12.68549 12.69225 12.69929 12.70656 12.71402 12.72164
## [129] 12.72938 12.73721 12.74507 12.75295 12.76080 12.76857 12.77625 12.78378
## [137] 12.79113 12.79827 12.80514 12.81173 12.81799 12.82388 12.83091 12.84046
## [145] 12.85226 12.86606 12.88160 12.89861 12.91684 12.93603 12.95592 12.97625
## [153] 12.99676 13.01720 13.03730 13.05680 13.07545 13.09298 13.10914 13.12367
## [161] 13.13631 13.14680 13.15488 13.16210 13.17014 13.17891 13.18834 13.19833
## [169] 13.20882 13.21972 13.23095 13.24243 13.25407 13.26581 13.27755 13.28921
## [177] 13.30072 13.31199 13.32295 13.33350 13.34358 13.35310 13.36198 13.37013
## [185] 13.37748 13.38395 13.38946 13.39392 13.39725 13.39937 13.40021 13.39968
## [193] 13.39770 13.39419 13.38907 13.38225 13.37295 13.36061 13.34550 13.32789
## [201] 13.30805 13.28625 13.26277 13.23788 13.21185 13.18494 13.15744 13.12962
## [209] 13.10174 13.07407 13.04690 13.02048 12.99510 12.97101 12.94851 12.92785
## [217] 12.90931 12.89026 12.86812 12.84321 12.81587 12.78643 12.75521 12.72254
## [225] 12.68876 12.65418 12.61916 12.58400 12.54905 12.51462 12.48106 12.44869
## [233] 12.41783 12.38883 12.36200 12.33768 12.31620 12.29789 12.28141 12.26523
## [241] 12.24934 12.23377 12.21850 12.20355 12.18894 12.17465 12.16070 12.14710
## [249] 12.13386 12.12097 12.10845 12.09631 12.08454 12.07317 12.06218 12.05160
## [257] 12.04143 12.03166 12.02232 12.01471 12.00994 12.00773 12.00781 12.00991
## [265] 12.01375 12.01906 12.02555 12.03295 12.04099 12.04939 12.05788 12.06618
## [273] 12.07401 12.08110 12.08717 12.09196 12.09517 12.09654 12.09579 12.09265
## [281] 12.08879 12.08600 12.08416 12.08313 12.08280 12.08304 12.08372 12.08472
## [289] 12.08591 12.08718 12.08839 12.08942 12.09014 12.09043 12.09017 12.08923
## [297] 12.08748 12.08480 12.08106 12.07615 12.06993 12.06195 12.05198 12.04021
## [305] 12.02686 12.01211 11.99617 11.97925 11.96153 11.94324 11.92455 11.90569
## [313] 11.88684 11.86821 11.84999 11.83240 11.81564 11.79989 11.78537 11.77228
## [321] 11.76081 11.75117 11.74098 11.72796 11.71244 11.69476 11.67525 11.65427
## [329] 11.63214 11.60919 11.58578 11.56224 11.53890 11.51610 11.49418 11.47348
## [337] 11.45434 11.43709 11.42207 11.40962 11.40008 11.39378 11.39107 11.39075
## [345] 11.39138 11.39294 11.39538 11.39868 11.40281 11.40772 11.41340 11.41980
## [353] 11.42689 11.43464 11.44302 11.45198 11.46151 11.47157 11.48212 11.49314
## [361] 11.50458 11.51642 11.52862 11.54115 11.55561 11.57344 11.59433 11.61800
## [369] 11.64415 11.67250 11.70274 11.73458 11.76774 11.80192 11.83682 11.87216
## [377] 11.90764 11.94297 11.97786 12.01201 12.04513 12.07692 12.10710 12.13538
## [385] 12.16145 12.18503 12.20583 12.22659 12.25004 12.27584 12.30363 12.33308
## [393] 12.36383 12.39554 12.42787 12.46047 12.49299 12.52510 12.55644 12.58666
## [401] 12.61544 12.64240 12.66723 12.68956 12.70905 12.72536 12.74026 12.75568
## [409] 12.77152 12.78764 12.80393 12.82029 12.83658 12.85269 12.86851 12.88392
## [417] 12.89880 12.91304 12.92652 12.93912 12.95072 12.96121 12.97048 12.97840
## [425] 12.98486 12.98973 12.99292 12.99391 12.99241 12.98864 12.98278 12.97505
## [433] 12.96564 12.95475 12.94259 12.92936 12.91525 12.90047 12.88523 12.86972
## [441] 12.85414 12.83870 12.82359 12.80902 12.79519 12.78230 12.77056 12.76016
## [449] 12.74883 12.73439 12.71716 12.69749 12.67570 12.65212 12.62708 12.60092
## [457] 12.57396 12.54654 12.51898 12.49162 12.46479 12.43882 12.41404 12.39079
## [465] 12.36938 12.35016 12.33345 12.31959 12.30891 12.29915 12.28797 12.27556
## [473] 12.26211 12.24782 12.23289 12.21749 12.20184 12.18611 12.17050 12.15521
## [481] 12.14043 12.12635 12.11317 12.10107 12.09025 12.08091 12.07323 12.06742
## [489] 12.06365 12.06213 12.06246 12.06406 12.06683 12.07069 12.07556 12.08136
## [497] 12.08799 12.09538 12.10343 12.11206 12.12119 12.13073 12.14060 12.15070
## [505] 12.16097 12.17130 12.18162 12.19183 12.20187 12.21163 12.22103 12.23234
## [513] 12.24761 12.26647 12.28855 12.31348 12.34088 12.37037 12.40158 12.43415
## [521] 12.46769 12.50183 12.53620 12.57042 12.60413 12.63694 12.66849 12.69840
## [529] 12.72629 12.75180 12.77454 12.79415 12.81025 12.82247 12.83314 12.84476
## [537] 12.85721 12.87037 12.88412 12.89834 12.91291 12.92770 12.94260 12.95748
## [545] 12.97223 12.98672 13.00083 13.01444 13.02744 13.03969 13.05109 13.06150
## [553] 13.07081 13.07890 13.08564 13.09092 13.09461 13.09660 13.09676 13.09497
## [561] 13.09111 13.08506 13.07614 13.06396 13.04880 13.03096 13.01071 12.98836
## [569] 12.96419 12.93849 12.91155 12.88366 12.85512 12.82620 12.79720 12.76841
## [577] 12.74011 12.71261 12.68619 12.66113 12.63773 12.61627 12.59706 12.57687
## [585] 12.55258 12.52463 12.49345 12.45947 12.42312 12.38484 12.34506 12.30420
## [593] 12.26270 12.22100 12.17952 12.13870 12.09896 12.06074 12.02448 11.99059
## [601] 11.95953 11.93171 11.90756 11.88753 11.86911 11.84963 11.82927 11.80820
## [609] 11.78660 11.76466 11.74254 11.72042 11.69849 11.67692 11.65589 11.63557
## [617] 11.61615 11.59780 11.58069 11.56501 11.55094 11.53864 11.52831 11.52010
## [625] 11.51422 11.51067 11.50926 11.50984 11.51226 11.51635 11.52197 11.52897
## [633] 11.53718 11.54645 11.55663 11.56757 11.57911 11.59110 11.60338 11.61580
## [641] 11.62821 11.64044 11.65236 11.66379 11.67460 11.68462 11.69580 11.70998
## [649] 11.72688 11.74621 11.76771 11.79107 11.81601 11.84226 11.86953 11.89753
## [657] 11.92598 11.95460 11.98310 12.01120 12.03862 12.06507 12.09026 12.11392
## [665] 12.13575 12.15549 12.17283 12.18914 12.20594 12.22316 12.24076 12.25870
## [673] 12.27693 12.29538 12.31403 12.33281 12.35167 12.37058 12.38947 12.40831
## [681] 12.42704 12.44560 12.46397 12.48207 12.49987 12.51732 12.53436 12.55095
## [689] 12.56704 12.58258 12.59752 12.61181 12.62541 12.63862 12.65178 12.66490
## [697] 12.67794 12.69091 12.70378 12.71655 12.72920 12.74173 12.75411 12.76634
## [705] 12.77841 12.79029 12.80199 12.81349 12.82477 12.83582 12.84664 12.85720
## [713] 12.86751 12.87753 12.88734 12.89700 12.90651 12.91586 12.92506 12.93410
## [721] 12.94297 12.95167 12.96021 12.96858 12.97678 12.98480 12.99265 13.00031
## [729] 13.00779 13.01509 13.02220 13.02912 13.03585 13.04238 13.04871 13.05483
## [737] 13.06072 13.06639 13.07185 13.07709 13.08213 13.08697 13.09162 13.09607
## [745] 13.10034 13.10443 13.10834 13.11209 13.11568 13.11910 13.12237
#assign fits to a vector
both_trendb <- fit_bothb

#extract y min and max for each
limits_bothb <- ggplot_build(extract_bothb)$data
## `geom_smooth()` using formula 'y ~ x'
limits_bothb <- as.data.frame(limits_bothb)
both_yminb <- limits_bothb$ymin
both_ymaxb <- limits_bothb$ymax

#reassign dataframes (just to be safe)
work_bothb <- wrfb_both

#fill in missing dates to smooth fits
work_bothb <- work_bothb %>% complete(date = seq(min(date), max(date), by = "1 day"))
date_vec_bothb <- work_bothb$date

#create a new smooth dataframe to layer
smooth_frame_bothb <- data.frame(date_vec_bothb, both_trendb, both_yminb, both_ymaxb)
#WRF B
#plot smooth frames
p_wrf_b <- plotly::plot_ly() %>%
  plotly::add_lines(x = ~date_vec_bothb, y = ~both_trendb,
                    data = smooth_frame_bothb,
                    hoverinfo = "text",
                    text = ~paste('</br> Date: ', date_vec_bothb,
                                  '</br> Median Log Copies: ', round(both_trendb, digits = 2)),
                    line = list(color = '#D95F02', size = 8, opacity = 0.65),
                    showlegend = FALSE) %>%
     layout(xaxis = list(range = c(mindate - 7, maxdate + 7))) %>% #buffer here
plotly::add_ribbons(x ~date_vec_bothb, ymin = ~both_yminb, ymax = ~both_ymaxb,
                    showlegend = FALSE,
                    opacity = 0.25,
                    hoverinfo = "text",
                    text = ~paste('</br> Date: ', date_vec_bothb, #leaving in case we want to change
                                  '</br> Max Log Copies: ', round(both_ymaxb, digits = 2),
                                  '</br> Min Log Copies: ', round(both_yminb, digits = 2)),
                    name = "",
                    fillcolor = '#D95F02',
                    line = list(color = '#D95F02')) %>%
                layout(yaxis = list(title = "Total Log10 SARS CoV-2 Copies", 
                                 showline = TRUE,
                                 automargin = TRUE)) %>%
                layout(xaxis = list(title = "Date")) %>%
                layout(title = "WRF B") %>%
  plotly::add_markers(x = ~date, y = ~log_total_copies_both,
                      data = wrfb_both,
                       hoverinfo = "text",
                       showlegend = FALSE,
                       text = ~paste('</br> Date: ', date, 
                                     '</br> Actual Log Copies: ', round(log_total_copies_both, digits = 2)),
                       marker = list(color = '#D95F02', size = 6, opacity = 0.65))

p_wrf_b
save(p_wrf_b, file = "./plotly_objs/p_wrf_b.rda")

#**************************************WRF C PLOT********************************************** #add trendlines #extract data from geom_smooth # *********************************span 0.6*********************************** #*****************Must always update the n = TOTAL NUMBER OF DAYS*************************

extract_bothc <- ggplot(wrfc_both, aes(x = date, y = log_total_copies_both)) + 
  stat_smooth(aes(outfit=fit_bothc<<-..y..), method = "loess", color = '#E7298A', 
              span = 0.25, n = 751)
## Warning: Ignoring unknown aesthetics: outfit
#look at the fits to align dates and total observations
#both
extract_bothc
## `geom_smooth()` using formula 'y ~ x'

fit_bothc
##   [1] 12.04344 12.03746 12.03158 12.02579 12.02011 12.01452 12.00902 12.00361
##   [9] 11.99828 11.99304 11.98788 11.98281 11.97780 11.97288 11.96802 11.96323
##  [17] 11.95851 11.95386 11.94926 11.94473 11.94025 11.93583 11.93146 11.92714
##  [25] 11.92286 11.91863 11.91445 11.91030 11.90619 11.90211 11.89807 11.89405
##  [33] 11.89007 11.88610 11.88216 11.87824 11.87434 11.87045 11.86658 11.86271
##  [41] 11.85885 11.85500 11.85114 11.84730 11.84348 11.83968 11.83590 11.83216
##  [49] 11.82846 11.82479 11.82117 11.81759 11.81407 11.81061 11.80720 11.80386
##  [57] 11.80059 11.79739 11.79427 11.79123 11.78828 11.78542 11.78265 11.77998
##  [65] 11.77741 11.77494 11.77259 11.77036 11.76824 11.76624 11.76437 11.76264
##  [73] 11.76103 11.75957 11.75826 11.75709 11.75607 11.75521 11.75451 11.75397
##  [81] 11.75360 11.75341 11.75339 11.75356 11.75391 11.75430 11.75462 11.75486
##  [89] 11.75505 11.75519 11.75530 11.75539 11.75547 11.75555 11.75565 11.75578
##  [97] 11.75595 11.75618 11.75647 11.75684 11.75731 11.75787 11.75856 11.75937
## [105] 11.76033 11.76144 11.76271 11.76417 11.76582 11.76767 11.76973 11.77203
## [113] 11.77457 11.77736 11.78042 11.78376 11.78738 11.79132 11.79557 11.80014
## [121] 11.80506 11.81034 11.81598 11.82199 11.82840 11.83522 11.84323 11.85312
## [129] 11.86471 11.87784 11.89235 11.90806 11.92480 11.94241 11.96072 11.97956
## [137] 11.99877 12.01817 12.03760 12.05689 12.07587 12.09438 12.11224 12.12929
## [145] 12.14536 12.16028 12.17389 12.18867 12.20698 12.22845 12.25271 12.27938
## [153] 12.30810 12.33850 12.37021 12.40284 12.43604 12.46944 12.50265 12.53532
## [161] 12.56706 12.59752 12.62631 12.65307 12.67743 12.69901 12.71745 12.73237
## [169] 12.74570 12.75956 12.77385 12.78850 12.80342 12.81853 12.83375 12.84898
## [177] 12.86416 12.87919 12.89398 12.90847 12.92256 12.93617 12.94921 12.96161
## [185] 12.97328 12.98413 12.99409 13.00306 13.01097 13.01773 13.02325 13.02746
## [193] 13.03027 13.03160 13.03136 13.02947 13.02585 13.02040 13.01219 13.00049
## [201] 12.98563 12.96792 12.94766 12.92515 12.90072 12.87467 12.84730 12.81893
## [209] 12.78986 12.76040 12.73087 12.70156 12.67280 12.64488 12.61812 12.59282
## [217] 12.56930 12.54786 12.52881 12.50926 12.48632 12.46036 12.43173 12.40078
## [225] 12.36787 12.33335 12.29758 12.26090 12.22368 12.18627 12.14901 12.11227
## [233] 12.07640 12.04175 12.00868 11.97753 11.94867 11.92245 11.89922 11.87934
## [241] 11.86153 11.84428 11.82754 11.81129 11.79551 11.78015 11.76520 11.75062
## [249] 11.73638 11.72245 11.70880 11.69540 11.68223 11.66925 11.65643 11.64374
## [257] 11.63115 11.61864 11.60617 11.59371 11.58124 11.56981 11.56039 11.55279
## [265] 11.54681 11.54228 11.53899 11.53676 11.53540 11.53473 11.53454 11.53466
## [273] 11.53488 11.53503 11.53492 11.53434 11.53312 11.53106 11.52798 11.52368
## [281] 11.51798 11.51068 11.50290 11.49582 11.48938 11.48352 11.47816 11.47325
## [289] 11.46871 11.46448 11.46050 11.45669 11.45300 11.44936 11.44570 11.44195
## [297] 11.43805 11.43394 11.42955 11.42480 11.41965 11.41402 11.40784 11.40017
## [305] 11.39028 11.37840 11.36477 11.34965 11.33327 11.31588 11.29771 11.27902
## [313] 11.26004 11.24102 11.22219 11.20381 11.18611 11.16934 11.15374 11.13955
## [321] 11.12702 11.11638 11.10788 11.10177 11.09612 11.08898 11.08057 11.07107
## [329] 11.06071 11.04969 11.03820 11.02647 11.01469 11.00306 10.99180 10.98111
## [337] 10.97120 10.96226 10.95451 10.94816 10.94340 10.94044 10.93950 10.94076
## [345] 10.94445 10.95061 10.95906 10.96961 10.98207 10.99627 11.01203 11.02916
## [353] 11.04748 11.06681 11.08697 11.10778 11.12905 11.15060 11.17226 11.19383
## [361] 11.21514 11.23601 11.25626 11.27570 11.29415 11.31142 11.32931 11.34958
## [369] 11.37203 11.39647 11.42271 11.45056 11.47981 11.51028 11.54178 11.57410
## [377] 11.60706 11.64046 11.67411 11.70782 11.74138 11.77461 11.80732 11.83930
## [385] 11.87037 11.90033 11.92899 11.95616 11.98163 12.00523 12.02674 12.04599
## [393] 12.06496 12.08558 12.10756 12.13062 12.15445 12.17878 12.20330 12.22772
## [401] 12.25177 12.27514 12.29754 12.31868 12.33828 12.35604 12.37166 12.38487
## [409] 12.39667 12.40826 12.41960 12.43068 12.44146 12.45192 12.46204 12.47177
## [417] 12.48111 12.49002 12.49847 12.50644 12.51390 12.52082 12.52718 12.53295
## [425] 12.53810 12.54261 12.54645 12.54959 12.55201 12.55299 12.55193 12.54902
## [433] 12.54442 12.53831 12.53086 12.52224 12.51263 12.50219 12.49110 12.47952
## [441] 12.46764 12.45563 12.44365 12.43188 12.42049 12.40965 12.39953 12.39031
## [449] 12.38216 12.37526 12.36811 12.35926 12.34888 12.33712 12.32418 12.31021
## [457] 12.29538 12.27988 12.26387 12.24752 12.23100 12.21449 12.19815 12.18216
## [465] 12.16669 12.15190 12.13798 12.12509 12.11340 12.10309 12.09432 12.08559
## [473] 12.07542 12.06397 12.05144 12.03800 12.02384 12.00914 11.99408 11.97885
## [481] 11.96362 11.94857 11.93390 11.91978 11.90639 11.89392 11.88255 11.87246
## [489] 11.86383 11.85684 11.85168 11.84853 11.84687 11.84601 11.84593 11.84659
## [497] 11.84796 11.84999 11.85266 11.85593 11.85976 11.86412 11.86897 11.87428
## [505] 11.88001 11.88613 11.89260 11.89938 11.90644 11.91375 11.92126 11.92895
## [513] 11.93678 11.94470 11.95270 11.96073 11.96875 11.97674 11.98639 11.99922
## [521] 12.01489 12.03307 12.05340 12.07556 12.09921 12.12400 12.14960 12.17568
## [529] 12.20189 12.22789 12.25335 12.27792 12.30128 12.32307 12.34297 12.36064
## [537] 12.37573 12.38790 12.39683 12.40440 12.41267 12.42157 12.43100 12.44089
## [545] 12.45114 12.46169 12.47244 12.48331 12.49423 12.50510 12.51584 12.52637
## [553] 12.53661 12.54648 12.55588 12.56475 12.57299 12.58052 12.58726 12.59312
## [561] 12.59803 12.60190 12.60464 12.60618 12.60643 12.60531 12.60273 12.59804
## [569] 12.59085 12.58146 12.57017 12.55729 12.54311 12.52793 12.51206 12.49580
## [577] 12.47945 12.46331 12.44768 12.43287 12.41917 12.40689 12.39633 12.38483
## [585] 12.36976 12.35149 12.33038 12.30679 12.28109 12.25364 12.22480 12.19494
## [593] 12.16441 12.13358 12.10281 12.07246 12.04291 12.01450 11.98760 11.96258
## [601] 11.93980 11.91962 11.90240 11.88851 11.87598 11.86272 11.84883 11.83444
## [609] 11.81968 11.80466 11.78952 11.77438 11.75935 11.74456 11.73014 11.71620
## [617] 11.70288 11.69029 11.67856 11.66781 11.65817 11.64975 11.64268 11.63709
## [625] 11.63309 11.63093 11.63067 11.63215 11.63522 11.63973 11.64552 11.65246
## [633] 11.66037 11.66912 11.67855 11.68851 11.69885 11.70941 11.72005 11.73062
## [641] 11.74095 11.75090 11.76033 11.76906 11.77697 11.78389 11.79120 11.80028
## [649] 11.81095 11.82305 11.83639 11.85082 11.86615 11.88221 11.89884 11.91585
## [657] 11.93309 11.95037 11.96752 11.98438 12.00077 12.01651 12.03144 12.04539
## [665] 12.05817 12.06963 12.07959 12.08889 12.09847 12.10830 12.11835 12.12857
## [673] 12.13894 12.14941 12.15997 12.17056 12.18117 12.19174 12.20226 12.21268
## [681] 12.22297 12.23309 12.24302 12.25271 12.26214 12.27126 12.28005 12.28846
## [689] 12.29648 12.30405 12.31115 12.31774 12.32379 12.32953 12.33519 12.34078
## [697] 12.34627 12.35167 12.35697 12.36215 12.36721 12.37214 12.37692 12.38156
## [705] 12.38604 12.39036 12.39450 12.39846 12.40223 12.40579 12.40915 12.41229
## [713] 12.41520 12.41788 12.42037 12.42272 12.42493 12.42700 12.42892 12.43069
## [721] 12.43230 12.43376 12.43506 12.43620 12.43717 12.43797 12.43861 12.43906
## [729] 12.43934 12.43944 12.43935 12.43908 12.43861 12.43795 12.43710 12.43603
## [737] 12.43474 12.43323 12.43151 12.42959 12.42746 12.42514 12.42262 12.41992
## [745] 12.41704 12.41398 12.41076 12.40737 12.40382 12.40012 12.39627
#assign fits to a vector
both_trendc <- fit_bothc

#extract y min and max for each
limits_bothc <- ggplot_build(extract_bothc)$data
## `geom_smooth()` using formula 'y ~ x'
limits_bothc <- as.data.frame(limits_bothc)
both_yminc <- limits_bothc$ymin
both_ymaxc <- limits_bothc$ymax

#reassign dataframes (just to be safe)
work_bothc <- wrfc_both

#fill in missing dates to smooth fits
work_bothc <- work_bothc %>% complete(date = seq(min(date), max(date), by = "1 day"))
date_vec_bothc <- work_bothc$date

#create a new smooth dataframe to layer
smooth_frame_bothc <- data.frame(date_vec_bothc, both_trendc, both_yminc, both_ymaxc)
#WRF C
#plot smooth frames
p_wrf_c <- plotly::plot_ly() %>%
  plotly::add_lines(x = ~date_vec_bothc, y = ~both_trendc,
                    data = smooth_frame_bothc,
                    hoverinfo = "text",
                    text = ~paste('</br> Date: ', date_vec_bothc,
                                  '</br> Median Log Copies: ', round(both_trendc, digits = 2)),
                    line = list(color = '#E7298A', size = 8, opacity = 0.65),
                    showlegend = FALSE) %>%
     layout(xaxis = list(range = c(mindate - 7, maxdate + 7))) %>% #buffer here
plotly::add_ribbons(x ~date_vec_bothc, ymin = ~both_yminc, ymax = ~both_ymaxc,
                    showlegend = FALSE,
                    opacity = 0.25,
                    hoverinfo = "text",
                    text = ~paste('</br> Date: ', date_vec_bothc, #leaving in case we want to change
                                  '</br> Max Log Copies: ', round(both_ymaxc, digits = 2),
                                  '</br> Min Log Copies: ', round(both_yminc, digits = 2)),
                    name = "",
                    fillcolor = '#E7298A',
                    line = list(color = '#E7298A')) %>%
                layout(yaxis = list(title = "Total Log10 SARS CoV-2 Copies", 
                                 showline = TRUE,
                                 automargin = TRUE)) %>%
                layout(xaxis = list(title = "Date")) %>%
                layout(title = "WRF C") %>%
  plotly::add_markers(x = ~date, y = ~log_total_copies_both,
                      data = wrfc_both,
                       hoverinfo = "text",
                       showlegend = FALSE,
                       text = ~paste('</br> Date: ', date, 
                                     '</br> Actual Log Copies: ', round(log_total_copies_both, digits = 2)),
                       marker = list(color = '#E7298A', size = 6, opacity = 0.65))

p_wrf_c
save(p_wrf_c, file = "./plotly_objs/p_wrf_c.rda")
save(wrfa_both, file = "./plotly_objs/wrfa_both.rda")
save(wrfb_both, file = "./plotly_objs/wrfb_both.rda")
save(wrfc_both, file = "./plotly_objs/wrfc_both.rda")
save(date_vec_botha, file = "./plotly_objs/date_vec_botha.rda")
save(date_vec_bothb, file = "./plotly_objs/date_vec_bothb.rda")
save(date_vec_bothc, file = "./plotly_objs/date_vec_bothc.rda")
save(both_ymina, file = "./plotly_objs/both_ymina.rda")
save(both_ymaxa, file = "./plotly_objs/both_ymaxa.rda")

save(both_yminb, file = "./plotly_objs/both_yminb.rda")
save(both_ymaxb, file = "./plotly_objs/both_ymaxb.rda")

save(both_yminc, file = "./plotly_objs/both_yminc.rda")
save(both_ymaxc, file = "./plotly_objs/both_ymaxc.rda")